package com.gatico;

public class ProxyProtocol {
    public  byte[] GTC = new byte[]{71, 84, 67};
    public int v = 1;
    public byte type = 0;//0=心跳,1=tcp,2=http,3=msg
    public int ip=0;
    public int port=0;
    public int length = 0;
    public byte[] data;

    public ProxyDecoder.STATUS status;
    enum TYPE {
        HEART, TCP, HTTP, MSG;

        public byte value() {
            return (byte) this.ordinal();
        }
    }

    public static ProxyProtocol msgProtocol(String str) {
        ProxyProtocol protocol = new ProxyProtocol();
        protocol.type = TYPE.MSG.value();
        protocol.data = str.getBytes();
        protocol.length = protocol.data.length;
        return protocol;
    }

    public static ProxyProtocol heart() {
        return new ProxyProtocol();
    }
}
